import 'package:flutter/material.dart';
import 'package:flutter_app/pages/Form1.dart';
import '../search.dart';
import '../Form.dart';

class Homepage extends StatefulWidget {
  Homepage({Key? key}) : super(key: key);

  @override
  _HomepageState createState() => _HomepageState();
}

class _HomepageState extends State<Homepage> {
  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        ElevatedButton(
          onPressed: () {
            // Navigator.of(context)
            // .push(MaterialPageRoute(builder: (context) => Search()));
            Navigator.pushNamed(context, "/search", arguments: {
              "id": 123,
            });
          },
          child: Text("跳转到搜索页"),
        ),
        SizedBox(
          height: 20.0,
        ),
        ElevatedButton(
          onPressed: () {
            // Navigator.of(context).push(MaterialPageRoute(
            // builder: (context) => FormPage(title: "我是跳转传值")));
            Navigator.pushNamed(context, "/form");
          },
          child: Text("跳转到表单页面并传值"),
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.pushNamed(context, "/appBarDemo");
          },
          child: Text("AppbarDemo"),
        ),
        ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, '/product',
                  arguments: {"id": "666"});
            },
            child: Text("商品页面")),
        ElevatedButton(
          onPressed: () {
            Navigator.pushNamed(context, '/tabBarController');
          },
          child: Text("TabBarController"),
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.pushNamed(context, '/button');
          },
          child: Text("Button"),
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.pushNamed(context, '/radio');
          },
          child: Text("radio"),
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.pushNamed(context, '/http');
          },
          child: Text("网络请求"),
        ),
      ],
    );
  }
}
